﻿using ctolua.Models.Enum;

namespace ctolua.Models.UI.control
{
    public class MCButton : Mui
    {
        public override EUi type { get => EUi.按钮; set => base.type = EUi.按钮; }
        private int? _image_id;
        /// <summary>
        /// 图片ID
        /// </summary>
        public int? image_id
        {
            get => _image_id;
            set
            {
                if (value != null)
                {
                    game_api.set_ui_comp_image(this.role, this.id, value);
                }

                _image_id = value;
            }
        }

        private bool? _is_open;
        /// <summary>
        /// ui按钮是否开启多态
        /// </summary>
        public bool? is_open
        {
            get => _is_open;
            set
            {
                if (value != null)
                {
                    game_api.set_ui_comp_bar_status(this.role, this.id, value);
                }


                _is_open = value;
            }
        }

        private EKeyboardKey? _shortcut_key;
        /// <summary>
        /// 按钮快捷键
        /// </summary>
        public EKeyboardKey? shortcut_key
        {
            get => _shortcut_key;
            set
            {
                if (value != null)
                {
                    game_api.set_btn_short_cut(this.role, this.id, (int)value);
                }

                _shortcut_key = value;
            }
        }

        private EKeyboardKey? _secondary_keys;
        /// <summary>
        /// 按钮辅助键
        /// </summary>
        public EKeyboardKey? secondary_keys
        {
            get => _secondary_keys;
            set
            {
                if (value != null)
                {
                    game_api.set_btn_short_cut(this.role, this.id, (int)value);
                }

                _secondary_keys = value;
            }
        }

        private int? _floating_image;
        /// <summary>
        /// 悬浮态图片
        /// </summary>
        public int? floating_image
        {
            get => _floating_image;
            set
            {
                if (value != null)
                {
                    game_api.set_ui_comp_suspend_image(this.role, this.id, value);
                }

                _floating_image = value;
            }
        }

        private int? _press_image;
        /// <summary>
        /// 按下图片
        /// </summary>
        public int? press_image
        {
            get => _press_image;
            set
            {
                if (value != null)
                {
                    game_api.set_ui_comp_press_image(this.role, this.id, value);
                }

                _press_image = value;
            }
        }

        private int? _disabled_image;
        /// <summary>
        /// 禁用态图片
        /// </summary>
        public int? disabled_image
        {
            get => _disabled_image;
            set
            {
                if (value != null)
                {
                    game_api.set_ui_comp_disabled_image(this.role, this.id, value);
                }


                _disabled_image = value;
            }
        }

        public MCButton()
        {
        }

        public MCButton(string id) : base(id)
        {

        }

        public MCButton(MCButton u) : base(u)
        {
            this.type = u.type;
            this.is_open = u.is_open;
            this.press_image = u.press_image;
            this.image_id = u.image_id;
            this.floating_image = u.floating_image;
            this.disabled_image = u.disabled_image;
            this.shortcut_key = u.shortcut_key;
            this.secondary_keys = u.secondary_keys;

        }


    }
}
